Standardize TUI model updates on KeyPressMsg and constructor reuse - #30
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TUI architecture cleanup for
internal/model, replacingtea.KeyMsgwithtea.KeyPressMsg, making allUpdate()methods return copies, and routing entity creation throughbook.NewShelf/book.NewCollection.What's new
handleCommonKeysininternal/model/tea.gocentralizesctrl+c/esc/ctrl+pfor all six TUIUpdatemethods.get*models -getMarkModelandgetCollectionModelsync derived state via value-receiverreloadFromForm();View()no longer triggers side effects.edit*models -editShelfModel,editCollectionModel, andeditMarkModelcopy on form completion and wire entities before the write command runs.editShelfModelandeditCollectionModelcreate v2 shelves/collections throughbook.NewShelf/book.NewCollectioninstead of inline ID/timestamp assignments.ErrorProviderinterface letsrunProgramreturn TUI errors after exit;ResultViewsuppresses output on error.Behavior changes / guardrails
niland form constructors create local scaffolding structs (for example&book.Shelf{}) rather than storing fake values in the model.updateShelfFileCmdclosures now only add/touch entities and write files; creation happens inUpdate().Shelf.ValidateNewCollectionNamerejects empty or duplicate collection names in the TUI, matching the CLI behavior.getShelfModel.Viewnow displays the actual picked shelf name instead of the"fake"debug placeholder.markModel.verifyMarkis now a value receiver, matchingverifyCollection.Testing
make checkruns fmt, vet, lint, and tests; all green.